home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk16 / cat / cat.doc < prev    next >
Text File  |  1995-03-18  |  3KB  |  76 lines

  1. CAT
  2.  
  3. File concatenation program. 
  4.  
  5. By: DM Brown 
  6. Date: 23 April 1988 
  7.  
  8. This program picks up  where  the  JOIN  command and command line 
  9. output indirection left off. It  does  a true file concatenation, 
  10. meaning that  any  files  or  strings  on  the  command  line are 
  11. concatenated onto  the  end  of  the  output  file.  JOIN  always 
  12. overwrote the output  file,  where  this  program  can attach its 
  13. output to the end of the file.  
  14.  
  15. The command accepts three different arguments: 
  16.  
  17.      -a             set the command to append mode (default) 
  18.      -o             set the command to overwrite mode (like JOIN) 
  19.      -s "string"    append "string" onto the end of the file 
  20.  
  21. The usage is as follows: 
  22.  
  23.      cat [-a/-o/-s "string"] [file1 [,file2 ...]] [to] file 
  24.  
  25. The optional word 'to'  preceding  the last file name is optional 
  26. and ignored. Any number of arguments  can be place on the command 
  27. line and mixed any  way  desired.  However,  the last argument is 
  28. assumed to be the output file name.  At the very least, one input 
  29. file or a string and the output  file  are required. The '-a' and 
  30. the  '-o'  options  are  mutually  exclusive  and  the  last  one 
  31. specified before output has begun will be the one in force during 
  32. the rest of the command. After actual  output has begun, the '-a' 
  33. and '-o' options are read and  handled,  but  have no effect. The 
  34. output file is opened as soon as some  input is read which can be 
  35. written (that is  after  the  first  '-s  "string"'  or file name 
  36. argument). In append mode, a file can be concatenated to itself  
  37. as well. 
  38.  
  39. I realize that the preceding  paragraph  might  not make a lot of 
  40. sense, so I am including  an  example  of  it's  use. I wrote the 
  41. program in frustration of using JOIN and file output indirection. 
  42. There was no 'clean' way to  concatenate  files  and strings onto 
  43. the end of files  without  creating  a  lot of intermediate files 
  44. along the way. Of course,  it  grew  beyond  what I had initially 
  45. intended. I hope someone finds  it  useful. I included the source 
  46. for those who might find it interesting. 
  47.  
  48. Useful (?) example: 
  49.      
  50.     ; This script will list (dir) all the partitions of my 
  51.     ; hard disk. 
  52.      
  53.     date >ram:today 
  54.     cat -o -s  "Hard  Disk  Listing  --  DM  Brown"  ram:today to 
  55.     ram:hd_dir 
  56.      
  57.     dir >ram:temp dh0: opt a 
  58.     cat -s "" -s "DH0:" -s "" ram:temp to ram:hd_dir 
  59.      
  60.     dir >ram:temp dh1: opt a 
  61.     cat -s "" -s "DH1:" -s "" ram:temp to ram:hd_dir 
  62.      
  63.     dir >ram:temp dh2: opt a 
  64.     cat -s "" -s "DH2:" -s "" ram:temp to ram:hd_dir 
  65.      
  66.     dir >ram:temp dh3: opt a 
  67.     cat -s "" -s "DH3:" -s "" ram:temp to ram:hd_dir 
  68.      
  69.     cp ram:hd_dir t:hd_dir 
  70.     echo "done." 
  71.  
  72. If anyone wants to contact me  about  it (I don't think there are 
  73. any bugs) I can be reached at GEnie: 
  74.  
  75.      DMBROWN 
  76.